// Copyright 2012, Jun Chen .All rights reserved.
//
// Use of this source code is governed by a BSD-Style license that can be
// found in the License fule.
//
// Author: cpp.cheen at gmail dot com.


#ifndef ACCEPTOR_H
#define ACCEPTOR_H

#include    "pch_files.h"
#include    <boost/function.hpp>

class   endpoint_ipv4;
class   evt_dispather;
class   connection;

class acceptor:public boost::noncopyable
{
    public:
    boost::function<void(connection&,endpoint_ipv4&)>       accept_functor;
    public:
        /** Default constructor */
        acceptor(evt_dispather& evt_loop);
        /** Default destructor */
        virtual ~acceptor();
    protected:
        void        on_accept(x_fd fd,endpoint_ipv4& peer);
    private:
    x_fd        m_listen_fd;
};

#endif // ACCEPTOR_H
